#include "consignee.h"
#include "ui_consignee.h"

Consignee::Consignee(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Consignee)
{
    ui->setupUi(this);
    ui->pushButton->setDisabled(true);
    socket = SocketManager::getinstance().socket();
}

Consignee::~Consignee()
{
    delete ui;
}

void Consignee::on_pushButton_2_clicked()
{
    emit(returnreg());
}
//用户条例判断
void Consignee::on_checkBox_stateChanged(int arg1)
{
    if(arg1 == 0)
    {
        ui->pushButton->setDisabled(true);
    }
    else
    {
        ui->pushButton->setDisabled(false);
    }
}

//用户注册
void Consignee::on_pushButton_clicked()
{
    sendRig srg;
    const char* account = ui->lineEdit->text().toUtf8().constData();
    strcpy(srg.Account,account);
    const char* password = ui->lineEdit_2->text().toUtf8().constData();
    strcpy(srg.password,password);
    const char* telenum = ui->lineEdit_3->text().toUtf8().constData();
    strcpy(srg.tele,telenum);
    srg.type=1;
    srg.IC=0;
    srg.Idtype = true;
    QByteArray data;
    data.append((char*)&srg,sizeof (sendRig));
    socket->write(data);
}
